package com.zy.edu.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.edu.bean.CourseChapterClass;
import com.zy.edu.bean.CourseChapterSign;
import com.zy.edu.dao.CourseChapterSignDao;
import com.zy.edu.service.CourseChapterSignService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author HuangHaiShui
 * @since 2021-08-19
 */
@Service
public class CourseChapterSignServiceImpl extends ServiceImpl<CourseChapterSignDao, CourseChapterSign> implements CourseChapterSignService {

    @Override
    public Integer getCountByParam(String classId) {
        EntityWrapper<CourseChapterSign> entityWrapper = new EntityWrapper<>();
        entityWrapper.eq("class_id",classId);
        Integer count = this.baseMapper.selectCount(entityWrapper);
        return count;
    }

    @Override
    public Integer getCountByCourseAndStuId(String userId, String courseId) {
        EntityWrapper<CourseChapterSign> entityWrapper = new EntityWrapper<>();
        entityWrapper.eq("user_id",userId);
        entityWrapper.eq("course_id",courseId);
        Integer count = this.baseMapper.selectCount(entityWrapper);
        return count;
    }
}
